#!/bin/bash
# repairtxt - Repairs .txt-Files in traindata
#
# $1:
# r - recode
# m - mv to correct name (
# e - add eol to every line to avoid noeol

[ "$#" = '0' ] && echo "repairtxt [r][m][e]  -  cat repairtxt for more infos"
#ibmpc: Windows
#lat1: Linux

IFS=' '

if [[ `echo $1|grep r` ]]
then
	for datei in traindata/*.txt
	do
		recode ibmpc..lat1 $datei
	done
fi

if [[ `echo $1|grep m` ]]
then
	for datei in traindata/*.wav.txt
	do
		ndatei=`echo $datei | sed sI.wav.txtI.txtIg`
		mv $datei $ndatei
	done
fi

if [[ `echo $1|grep e` ]]
then
	sed -i.old 's/$/\n/g' traindata/*.txt
fi
